package com.example.scenictourback.dto;

import com.example.scenictourback.entity.Order;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class OrderDTO {
    
    private Integer id;
    private String orderNo;
    private Integer userId;
    private String username;
    private Integer type; // 1-门票, 2-酒店
    private Integer productId;
    private String productName; // 产品名称（门票名或酒店房间类型）
    private Integer quantity;
    private BigDecimal totalAmount;
    private Date bookDate;
    private Date useDate;
    private Integer status; // 1-待支付, 2-已支付, 3-已完成, 4-已取消
    
    public static OrderDTO fromEntity(Order entity) {
        OrderDTO dto = new OrderDTO();
        dto.setId(entity.getId());
        dto.setOrderNo(entity.getOrderNo());
        dto.setUserId(entity.getUser().getId());
        dto.setUsername(entity.getUser().getUsername());
        dto.setType(entity.getType());
        dto.setProductId(entity.getProductId());
        dto.setQuantity(entity.getQuantity());
        dto.setTotalAmount(entity.getTotalAmount());
        dto.setBookDate(entity.getBookDate());
        dto.setUseDate(entity.getUseDate());
        dto.setStatus(entity.getStatus());
        
        return dto;
    }
} 